<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var reg = /window(?!2000|xp)/ig;
    var s = 'window2000 window3000 windowXP';//021 23442344

       var r2 = s.replace(reg,function($0){//根据auguments推出的，参数的个数与正则中括号的个数成一定关系
            console.log($0)
           return '';
       });
    console.log(r2);
</script>
</body>
</html>